<template>
  <div>
    <el-carousel :interval="4000" type="card" height="250px" v-loading="show">
        <el-carousel-item v-for="(item, index) in lbList" :key="index">
            <img class="medium" style="width:100%" :src="item.lbimg_pic" />
        </el-carousel-item>
    </el-carousel>
    <div style="margin-top: 1vw"  class="mycard">
      <span class="words">推荐歌单<i class="el-icon-arrow-right"></i></span>
      <el-row >
        <el-col :span="3" v-for="(item, index) in zjList" :key="index" :offset="index % 5 == 0 ? 0 : 2">
          <el-card :body-style="{ padding: '0px'}" style="width: 13.1vw">
            <img :src="item.pic" class="image" style="height:15vw">
            <div style="padding: 10px; text-align: center;">
              <span @click="songdetail(item.aid)">{{item.aname}}</span>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
    <div style="margin-top: 3vw"  class="mycard">
      <span class="words">音乐分类<i class="el-icon-arrow-right"></i></span>
      <el-row >
        <!-- 13.1 14.9宽度 根据侧边设置 -->
        <el-col :span="3" v-for="(item, index) in classifyList" :key="index" :offset="index % 5 == 0 ? 0 : 2">
          <el-card class="cardfenlei" shadow="hover" :body-style="{ padding: '0px'}" style="width: 13.1vw">
            <div slot="header" style="text-align: center">
              <span>{{item.tname}}</span>
            </div>
            <div style="display: flex; width: 100%; height: 9vw; align-items: center; justify-content: center;">
              <span>{{item.tdesc}}</span>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
export default {
  name: "HomeMain",
  components: {},
  data() {
    return {
      lbList:[],
      zjList:[],
      classifyList:[],
    }
  },
  created() {
    this.getClassifyList();
    this.getLbList();
    this.getzjList();
  },
  methods: {
    async getClassifyList() {
      const res = await this.$http.get('music/mtype');
      this.classifyList = res.data.data;
      // console.log(this.classifyList);
    },
    async getLbList() {
      const reslb = await this.$http.get('music/findAllLbimg');
      this.lbList = reslb.data.data;
      // console.log(this.lbList);
    },
    async getzjList() {
      const reszj = await this.$http.get('music/findAllAlbum');
      this.zjList = reszj.data.data;
      // console.log(this.zjList);
    },
    songdetail(id) {
      console.log(id);
      this.$router.push({
        path: '/SongDetail',
        query: {zjnum: id}
      });
    }
  }
}
</script>
<style lang="less">
  .words {
    font-size:2rem;
    padding-left: 20px;
    color: #ffffff;
    text-shadow: -3px -2px 3px #dbdada, 4px 3px 3px #444444;
  }
  .mycard {
    padding-top: 20px;
    padding-bottom: 10px;
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.2);
  }

  .el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 200px;
    margin: 0;
  }
  
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }
  
  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }

  .el-card {
    margin-top: 30px;
  }
  .el-card__header {
    background: #5a8cbb;
    color: #ffffff;
  }
  .cardfenlei {
    height: 14vw
  }

  .image {
    width: 100%;
    display: block;
  }

</style>